package org.thanos.demo.listener;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.thanos.demo.config.DynamicTaskConfigurer;


@Component
@Slf4j
public class StartupListener implements ApplicationListener<ApplicationReadyEvent> {

    @Resource
    private DynamicTaskConfigurer dynamicTaskConfigurer;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
        dynamicTaskConfigurer.initTask();
        log.info("started.");
    }
}
